package dialogs;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.View;
import android.widget.TextView;

import com.example.administrator.newxlmedical.R;

import beans.RegisterInfoBean;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import custom.MyDialog;
import utils.FormateUtils;

/**
 * Created by Administrator on 2018/5/14.
 */

public class HospitalRegisterInfoDialog extends MyDialog {
    @BindView(R.id.tv_dialog_hospital_register_info_code)
    TextView tvCode;
    @BindView(R.id.tv_dialog_hospital_register_info_name)
    TextView tvName;
    @BindView(R.id.tv_dialog_hospital_register_info_depart)
    TextView tvDepart;
    @BindView(R.id.tv_dialog_hospital_register_info_role)
    TextView tvRole;
    @BindView(R.id.tv_dialog_hospital_register_info_cancle)
    TextView tvCancle;
    @BindView(R.id.tv_dialog_hospital_register_info_sure)
    TextView tvSure;

    private RegisterInfoBean registerInfoBean;
    private OnClickListener onClickListener;

    public HospitalRegisterInfoDialog(@NonNull Context context, @StyleRes int themeResId,RegisterInfoBean registerInfoBean,OnClickListener onClickListener) {
        super(context, themeResId);
        this.registerInfoBean=registerInfoBean;
        this.onClickListener=onClickListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_hospital_register_info);
        ButterKnife.bind(this);
        tvCode.setText(registerInfoBean.getCode());
        tvName.setText(registerInfoBean.getName());
        tvDepart.setText(registerInfoBean.getDepartment());
        tvRole.setText(FormateUtils.getRole(registerInfoBean.getRegisterRole()));
    }

    @OnClick({R.id.tv_dialog_hospital_register_info_cancle, R.id.tv_dialog_hospital_register_info_sure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_dialog_hospital_register_info_cancle:
                dismiss();
                break;
            case R.id.tv_dialog_hospital_register_info_sure:
                onClickListener.onSureClickListener(this);
                break;
        }
    }
    public interface OnClickListener{
        void onSureClickListener(HospitalRegisterInfoDialog dialog);
    }
}
